package com.dailyblue.java.spring.cloud.jwt.gateway.service.impl;

import com.dailyblue.java.spring.cloud.example.commons.bean.User;
import com.dailyblue.java.spring.cloud.example.commons.util.JsonResult;
import com.dailyblue.java.spring.cloud.example.commons.util.ResultTool;
import com.dailyblue.java.spring.cloud.jwt.gateway.mapper.UserMapper;
import com.dailyblue.java.spring.cloud.jwt.gateway.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class UserServiceImpl implements UserService {
    @Resource
    private UserMapper userMapper;

    @Override
    public JsonResult login(String name, String pass) {
        User user = userMapper.login(name, pass);
        if (user == null) {
            return ResultTool.fail();
        }
        return ResultTool.success(user);
    }
}
